<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<div id="app">
    1<counter></counter>
</div>
<script src="https://unpkg.com/vue@2.6.14/dist/vue.js"></script>
<script>
   //可以通过调用Vue的component方法定义组件
   Vue.component('counter',{
    data:()=>({count:0}),
    methods:{
        increase(){
            this.count++;
        }
    },
    template:`<button @click="increase">{{count}}</button>`
   });
   var vm = new Vue({
    el:'#app',
    data:{msg:'hello'}
   });
</script>
</body>
</html>